import { useEffect } from 'react';
import styles from './index.module.scss'
import AddOne from "@/pages/exam/subject_add/components/AddOne";
import { useDispatch, useSelector } from 'react-redux';
import { AppDispatch } from '@/app/store';
import { get_subject_tree,select_tree_data,set_subject_two } from '@/store/slice/exam/subject';

function SubjectAdd() {
	let arr=[]
	while (arr.length < 50) {
		arr.push(`新数据 ${arr.length + 1}`)
	}

	const dispatch:AppDispatch=useDispatch()
	const treeData=useSelector(select_tree_data)

	useEffect(()=>{
		dispatch(get_subject_tree()).then(val=>{
			console.log(val);
			const data =val.payload[0].children[0]
			dispatch(set_subject_two(data))
			
		})
	},[])
	return (<div className={styles.examManage}>
			<div className={styles.add}>
				<AddOne treeData={treeData}></AddOne>
			</div>
			<div className={styles.bot}>
			<div className={styles.left}>
				{
					arr.map((item, index) => (
						<div key={index}>
							{item}--666
						</div>
					))
				}
			</div>
			<div className={styles.right}></div>
		</div>


	</div>)
}

export default SubjectAdd
